{% load i18n pages_tags %}

{% spaceless %}
{% if page_branch_in_menu %}
  {% for page in page_branch %}
  {% if page.in_menu %}
    <a href="{{ page.get_absolute_url }}" id="tree-menu-{{ page.html_id }}"
       class="mdl-navigation__link mdl-typography--text-uppercase {% if page.is_current %} active{% endif %} {% if page.is_current_or_ascendant %} active-branch{% endif %}">{{ page.title }}</a>
    {# wrap the next line with 'if page.is_current_or_ascendant' #}
    {# to only show child pages in the menu for the current page #}
    {% if page.has_children_in_menu %}{% page_menu page %}{% endif %}
  {% endif %}
  {% endfor %}
{% endif %}
{% endspaceless %}
